setRegistry
Type
function
Summary
Sets an entry in the Windows system registry.
Syntax
setRegistry(<keyPath>, <value> [, <type>])
Description
Use the setRegistry function to change the behavior of Windows.
The first part of the keyPath should be one of the predefined handle values. If the keyPath ends in "\", the new setting becomes the default value. For example, if you want files ending in ".rev" to automatically launch LiveCode, use the following command :
get setRegistry(\"HKEY_CLASSES_ROOT\.rev\\", \"LiveCode\")
If the key doesn't exist, the setRegistry function creates it in the registry.
To delete a subkey, set the subkey's value to empty.
If the type is a binary type, make sure the value is binary. (You can encode a string as binary data using the binaryEncode function.)
On Mac OS and Unix systems, the setRegistry function returns "not supported".
Be careful to use only carefully debugged entries with the setRegistry function. Changing entries in the registry|Windows registry to invalid values can cause the system to behave unexpectedly or stop functioning altogether.
Parameters
Name | Type | Description |
---|---|---|
keyPath | The keyPath parameter is the path to a registry entry. | |
value | The new setting for the entry specified by the keyPath. | |
type | enum |
Examples
setRegistry("HKEY_CLASSES_ROOT\.txt\", "NotePad")
if setRegistry(myEntry & "/",myValue) then open file myFile
setRegistry(theKey,empty)
Related
glossary: file, error message, return, Windows, binary file, registry, binary, command, behavior
control structure: function
function: binaryEncode, deleteRegistry, MCISendString
Compatibility and Support
Introduced
LiveCode 1.0
OS
windows
Platforms
desktop
server